package it.webrules.deploymanager.core.dy;

import it.webrules.deploymanager.core.dy.deploy.DeployException;
import it.webrules.deploymanager.core.dy.deploy.MBeanManager;

import java.io.IOException;

import javax.management.AttributeNotFoundException;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.ReflectionException;

public class MBeanManagerFake implements MBeanManager {

	private String returnThis;

	public MBeanManagerFake() {
	}

	public MBeanManagerFake(String returnThis) {
		this.returnThis = returnThis;
	}

	@Override
	public void findAJPConnector() throws MalformedObjectNameException, IOException, MBeanException, AttributeNotFoundException,
			InstanceNotFoundException, ReflectionException, DeployException {
	}

	@Override
	public ObjectName getAJPGlobalRequestProcessorObjectName() throws MalformedObjectNameException, IOException, MBeanException,
			AttributeNotFoundException, InstanceNotFoundException, ReflectionException {
		return null;
	}

	@Override
	public void pauseAJP() throws InstanceNotFoundException, MBeanException, ReflectionException, IOException,
			MalformedObjectNameException, AttributeNotFoundException {
	}

	@Override
	public void stopAJP() throws InstanceNotFoundException, MBeanException, ReflectionException, IOException, MalformedObjectNameException,
			AttributeNotFoundException {
	}

	@Override
	public void resumeAJP() throws InstanceNotFoundException, MBeanException, ReflectionException, IOException,
			MalformedObjectNameException, AttributeNotFoundException, DeployException {
	}

	@Override
	public void startAJP() throws InstanceNotFoundException, MBeanException, ReflectionException, IOException,
			MalformedObjectNameException, AttributeNotFoundException, DeployException {
	}

	@Override
	public boolean waitForProcessingAllRequest(Integer timeout) throws MalformedObjectNameException, NullPointerException, IOException,
			InterruptedException {
		return false;
	}

	@Override
	public void undeploy(String virtualhost, String contextname) throws MalformedObjectNameException, NullPointerException, IOException,
			InstanceNotFoundException, MBeanException, ReflectionException, DeployException {
	}

	@Override
	public boolean isDeployed(String virtualhost, String contextname) throws MalformedObjectNameException, NullPointerException,
			IOException, InterruptedException, DeployException {
		return false;
	}

	@Override
	public void waidUndeploy(String virtualhost, String contextname, Integer timeout) throws MalformedObjectNameException,
			NullPointerException, IOException, InterruptedException, DeployException {

	}

	@Override
	public void waidDeploy(String virtualhost, String contextname, Integer timeout) throws MalformedObjectNameException,
			NullPointerException, IOException, InterruptedException, DeployException {
	}

	@Override
	public boolean isAvailable() {
		return false;
	}

	@Override
	public Object getMBeanValue(String objectName, String attribute) throws Exception {
		return returnThis;
	}

	@Override
	public Object getMBeanValue(String objectName, String attribute, String subattribute) throws Exception {
		return returnThis;
	}

}
